﻿// //  ********************************************************************************
// //  Copyright (C) 2016 Sebastian Kenter. All rights reserved.
// // 
// //  Name    : PhotonServerProject | PhotonServerFramework | IClientHandlerRegistry.cs
// //  Created : 2016 - 03 - 21 10:03
// //  Modified: 2016 - 04 - 18 09:38
// //  ********************************************************************************

using System;
using ExitGames.Logging;
using PhotonServerFramework.Interfaces.Application;
using PhotonServerFramework.Interfaces.Client;

namespace PhotonServerFramework.Interfaces.Handler
{
    /// <summary>
    ///     Interface for the client handler registry
    /// </summary>
    public interface IClientHandlerRegistry
    {
        /// <summary>
        ///     Logger instance
        /// </summary>
        ILogger Logger { get; }

        /// <summary>
        ///     Register a client handler to the internal registry and the database
        /// </summary>
        /// <param name="clientHandler">The client handler to register</param>
        /// <param name="server">The server that registers the client handler</param>
        /// <returns>true if registered, otherwise false</returns>
        bool RegisterClientHandler(IClientTelegramHandler<IClientPeer> clientHandler, IServerApplication server);

        /// <summary>
        ///     Unregister a client handler internally and from the database
        /// </summary>
        /// <param name="handlerId">Unique ID of the client handler to unregister</param>
        /// <returns>true if unregistered, otherwise false</returns>
        bool UnregisterClientHandler(Guid handlerId);

        /// <summary>
        ///     Gets a client handler from the internal registry identified by it's unique handler id
        /// </summary>
        /// <param name="handlerId">The id of the client handler to look up in the internal registry</param>
        /// <returns>IClientTelegramHandler if found, otherwise null</returns>
        IClientTelegramHandler<IClientPeer> GetClientHandlerById(Guid handlerId);
    }
}
